package template.test;

import template.entity.Duck;

import java.util.Arrays;

/**测试鸭子数组的排序
 * @author yaojianfeng
 */
public class DuckSortTestDrive {
    public static void main(String[] args) {
        Duck[] ducks = {
                new Duck("zhangsan",18),
                new Duck("lisi",15),
                new Duck("wangwu",16),
                new Duck("maliu",19),

                new Duck("qiankulong",17),
                new Duck("zhoubapi",17)
        };
        System.out.println("=======排序前============");
        display(ducks);
        System.out.println("=======排序后============");
        Arrays.sort(ducks);
        display(ducks);





    }
    public static void display(Duck[] ducks){
        for (int i = 0; i < ducks.length; i++) {
            System.out.println(ducks[i]);
        }
    }
}
